﻿CREATE TABLE [dbo].[DimEDIEnvelope]
(
[BTSMessageID] [nvarchar] (100) NULL,
[BTSInterchangeID] [nvarchar] (100) NULL,
[ISA01_AuthorizationQualifier] [nvarchar] (50) NULL,
[ISA02_AuthorizationInformation] [nvarchar] (100) NULL,
[ISA03_SecurityQualifier] [nvarchar] (50) NULL,
[ISA04_SecurityInformation] [nvarchar] (100) NULL,
[ISA05_SenderQualifier] [nvarchar] (50) NULL,
[ISA06_SenderID] [nvarchar] (100) NULL,
[ISA07_ReceiverQualifier] [nvarchar] (50) NULL,
[ISA08_ReceiverID] [nvarchar] (100) NULL,
[ISA09_Date] [nvarchar] (50) NULL,
[ISA10_Time] [nvarchar] (50) NULL,
[ISA11_ControlStandardsID] [nvarchar] (50) NULL,
[ISA14_AcknowledgementRequested] [nvarchar] (50) NULL,
[ISA15_TestIndicator] [nvarchar] (50) NULL,
[ISA16_SubelementSeparator] [nvarchar] (50) NULL,
[DataElementSeparator] [nvarchar] (50) NULL,
[SegmentTerminator] [nvarchar] (50) NULL,
[GS01_FunctionalIDCode] [nvarchar] (50) NULL,
[GS02_ApplicationSenderCode] [nvarchar] (100) NULL,
[GS03_ApplicationReceiverCode] [nvarchar] (100) NULL,
[GS04_Date] [nvarchar] (50) NULL,
[GS05_Time] [nvarchar] (50) NULL,
[GS06_GroupControlNumber] [nvarchar] (100) NULL,
[GS07_ResponsibleAgencyCode] [nvarchar] (100) NULL,
[GS08_VersionIDCode] [nvarchar] (50) NULL,
[ST01_TransactionSetIDCode] [nvarchar] (50) NULL,
[ST02_TransactionSetControlNumber] [nvarchar] (100) NULL,
[RecordID] [bigint] NULL,
[ActivityID] [nvarchar] (128) NULL,
[ISA12_InterchangeControlVersionNumber] [nvarchar] (100) NULL,
[ISA13_InterchangeControlNumber] [nvarchar] (100) NULL,
[MessageID] [bigint] NULL,
[InterchangeID] [bigint] NULL,
[EDIEnvelopeID_Key] [int] NOT NULL IDENTITY(1, 1),
[Receive_UTC] [datetime] NULL,
[Receive_LocalTime] AS (dateadd(hour, -datediff(hour,getdate(),getutcdate()),[Receive_UTC])),
[MessageBody] [varchar] (max) NULL,
[InsertDate] [datetime] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]


